﻿using System.Data;
using System.Data.SqlClient;

namespace MyWeb.Data
{
    public class DistributionController : SqlDataProvider
    {
        #region [Distribution_GetByAll]

        public DataTable Distribution_GetByAll()
        {
            return GetDataTable("sp_Distribution_GetByAll");
        }

        #endregion

        #region [Distribution_GetById]

        public DataTable Distribution_GetById(int id)
        {
            var p1 = new SqlParameter("@id", id);
            return GetDataTable("sp_Distribution_GetById", p1);
        }

        #endregion

        #region [Distribution_Insert]

        public void Distribution_Insert(DistributionInfo distribution)
        {
            var p1 = new SqlParameter("@Distribution", distribution.Distribution);
            ExecuteStoreProcedure("sp_Distribution_Insert", p1);
        }

        #endregion

        #region [Distribution_Update]

        public void Distribution_Update(DistributionInfo distribution)
        {
            var p0 = new SqlParameter("@Id", distribution.Id);
            var p1 = new SqlParameter("@Distribution", distribution.Distribution);
            ExecuteStoreProcedure("sp_Distribution_Update", p0, p1);
        }

        #endregion

        #region [Distribution_Delete]

        public void Distribution_Delete(int id)
        {
            var p0 = new SqlParameter("@Id", id);
            ExecuteStoreProcedure("sp_Distribution_Delete", p0);
        }

        #endregion
    }
}